<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<title>下级佣金提现</title>
		<link rel="stylesheet" type="text/css" href="../../../../bangnuo/admin/layui/css/layui.css">
	</head>
	<body>
		<div>
			<div>
				<p style="margin: 20px; color: #007DDB; font-size: 20px; font-weight: bold;">下级佣金提现</p>
			</div>
			<hr />
			<div class="layui-card">
				<div class="layui-card-body" style="background-color: #01AAED;">

				</div>
			</div>
			<div>
				<form class="layui-form" action="">
					<div class="layui-form-item">
						<label class="layui-form-label">月份</label>
						<div class="layui-input-block">
							<div style="float: left;">
								<input type="text" name="startTime" required id="startTime" placeholder="开始时间" autocomplete="off" class="layui-input">
							</div>
							<div style="float: left; margin: 10px; font-weight: bold;">
								~
							</div>
							<div style="float: left;">
								<input type="text" name="endTime" required id="endTime" placeholder="结束时间" autocomplete="off" class="layui-input">
							</div>
							<div style="float: left;">
								<div class="layui-form-item">
									<label class="layui-form-label">代理商</label>
									<div class="layui-input-block">
										<select name="agent">
										</select>
									</div>
								</div>
							</div>
							<div style="float: left;">
								<div class="layui-form-item">
									<label class="layui-form-label">状态</label>
									<div class="layui-input-block">
										<select name="type">
											<option value="">全部</option>
											<option value="0">待确认</option>
											<option value="1">已确认</option>
										</select>
									</div>
								</div>
							</div>
							<div style="float: left;">
								<div class="layui-form-item">
									<div class="layui-input-block">
										<button class="layui-btn" lay-submit lay-filter="formDemo">查询</button>
									</div>
								</div>
							</div>
						</div>
					</div>
				</form>
			</div>
			<hr />
			<table id="demo" lay-filter="test"></table>
		</div>
	</body>
	<script type="text/javascript" src="../../../../bangnuo/admin/layui/layui.js"></script>
	<script type="text/javascript" src="../../../../bangnuo/admin/js/jquery-1.8.0.min.js"></script>
	<script type="text/html" id="status">
		{{# if(d.withdrawalStatus == 0){ }}
		<b style="color: blue;">审核中</b>
		{{# } else if(d.withdrawalStatus == 1) { }}
		<b style="color: red;">已驳回</b>
		{{# } else if(d.withdrawalStatus == 2) { }}
		<b style="color: red;">已打款</b>
		{{# } else if(d.withdrawalStatus == 3) { }}
		<b style="color: red;">未申请</b>
		{{# } }}
	</script>
	<script>
		layui.use(['form', 'table', 'laydate'], function() {
			var form = layui.form,
				table = layui.table,
				laydate = layui.laydate;

			//日期选择器
			laydate.render({
				elem: '#startTime',
				type: 'datetime'
			});

			//日期选择器
			laydate.render({
				elem: '#endTime',
				type: 'datetime'
			});

			//监听提交
			form.on('submit(formDemo)', function(data) {
				layer.msg(JSON.stringify(data.field));
				return false;
			});

			//第一个实例
			table.render({
				elem: '#demo',
				url: '/commission/findListNotStatus/1/10', //数据接口
				toolbar: '#toolbarDemo', //开启头部工具栏，并为其绑定左侧模板
				page: true, //开启分页
				method: 'post',
				contentType: "application/json;charset=UTF-8",
				response: {
					"statusName": "code",
					"statusCode": 10000,
					"msgName": "message",
					"countName": "total",
					"dataName": "queryResult"
				},
                where: {
                    //"startTime": data.field.startTime1,
                    //"endTime": data.field.endTime1,
                    "status":1
                },
				parseData: function(res) {
					return {
						"code": res.code,
						"message": res.message,
						"total": res.queryResult.total,
						"queryResult": res.queryResult.list
					};
				},
				request: {
					pageName: 'page' //页码的参数名称，默认：page
						,
					limitName: 'size' //每页数据量的参数名，默认：limit
				},
				cols: [
					[ //表头
						{ field: 'monthDate', title: '日期', sort: true, fixed: 'left' }
						, { field: 'agent', title: '代理商' }
						, { field: 'aliPay', title: '官方支付宝', sort: true, width: 150 }
						, { field: 'wxPay', title: '官方微信', sort: true, width: 150 }
						, { field: 'thirdParty', title: '间联通道', sort: true, width: 150 }
						, { field: 'sum', title: '合计', sort: true, width: 150 }
						, { field: 'withdrawalStatus', title: '状态', sort: true, width: 150,templet:"#status" }
						, { field: 'type', title: '操作', templet: '#barDemo' }
					]
				]
			});
			
			table.on('tool(test)', function(obj){ //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
			  var data = obj.data; //获得当前行数据
			  var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
			  var tr = obj.tr; //获得当前行 tr 的 DOM 对象（如果有的话）
			 
			  if(layEvent === 'details'){ //查看代理月明细
			  var index = layer.open({
			  	type: 2,
			  	area : ['1700px', '800px'],
			  	title : '查看商户月明细',
			  	content : '../../common/applications-under.html?orderTotalMonthId='+data.id+'&sum='+data.sum
			  });
			  layer.full(index);
			  }
			});
		});
	</script>

	<script type="text/html" id="barDemo">
		 <a class="layui-btn layui-btn-xs" lay-event="details">查看详情</a>
	</script>
</html>
